package com.sds.sweng.swat.miplatform.ui.design.models.commands;

import org.eclipse.gef.commands.Command;

import com.sds.sweng.swat.miplatform.ui.design.models.area.sub.TableSubArea;
import com.sds.sweng.swat.miplatform.ui.design.models.component.MTable;

public class CopyTableCommand extends Command {

	private TableSubArea targetModel;
	private MTable srcTable;
	private MTable orgTable;

	public CopyTableCommand(TableSubArea targetModel, MTable srcTable) {
		this.targetModel = targetModel;
		this.srcTable = srcTable.clone();
		this.orgTable = targetModel.getTable().clone();
	}

	public void execute() {
		targetModel.setTable(srcTable);
	}

	public void undo() {
		targetModel.setTable(orgTable);
	}

}
